import request from '@/config/axios'

// 值班 VO
export interface DutyVO {
  id: number // ID
  name: string // 值班人员
  deptName: string // 部门
  contactPhone: string // 联系电话
  dutyDate: Date // 值班日期
  userId: number // 创建人ID
}

// 值班 API
export const DutyApi = {
  // 查询值班分页
  getDutyPage: async (params: any) => {
    return await request.get({ url: `/cms/duty/page`, params })
  },

  // 查询值班详情
  getDuty: async (id: number) => {
    return await request.get({ url: `/cms/duty/get?id=` + id })
  },

  // 新增值班
  createDuty: async (data: DutyVO) => {
    return await request.post({ url: `/cms/duty/create`, data })
  },

  // 修改值班
  updateDuty: async (data: DutyVO) => {
    return await request.put({ url: `/cms/duty/update`, data })
  },

  // 删除值班
  deleteDuty: async (id: number) => {
    return await request.delete({ url: `/cms/duty/delete?id=` + id })
  },

  // 导出值班 Excel
  exportDuty: async (params) => {
    return await request.download({ url: `/cms/duty/export-excel`, params })
  },

  // 下载值班信息导入模板
  // importDutyTemplate:  () => {
  //   return  request.get({ url: `/cms/duty/get-import-template` })
  // },
}
// 下载值班信息导入模板
export const importDutyTemplate = () => {
  return request.download({ url: '/cms/duty/get-import-template' })
}
